package com.jy.wms.web;

import com.joyi.gate.comm.SessionInfo;
import com.joyi.gate.safety.vo.UserInfo;
import com.jy.wms.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/*
* 库区管理
* 路由页面
* */
@Controller
@RequestMapping("/kuqu")
public class WmsKqRouter {
    @Autowired
    SysMenuService menuService;

    //主页面
    @RequestMapping(value = "/toKq/{menu}")
    public String toKq(@PathVariable("menu") String menu, Model model) {
        model.addAttribute("functions",menuService.getFunctions(menu));
        return "base/kuqu/kuqu";
    }
    //库区增加页面
    @RequestMapping(value = "/addKq")
    public String addKq(Model model,HttpSession session) {
        UserInfo userinfo= (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckmc=String.valueOf(userinfo.getUser().getOrgName());//仓库名称
        model.addAttribute("ckmc",ckmc);
        return "base/kuqu/addKuqu";
    }
    //库区查看库位页面
    @RequestMapping(value = "/search_kw")
    public String getKw(String id, Model model) {
        model.addAttribute("id",id);
        return "base/kuqu/chaKuwei";
    }
    /*跳转到修改库区页面*/
    @RequestMapping(value = "/editKq")
    public String editKq(String id, Model model,HttpSession session) {
        UserInfo userinfo= (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckmc=String.valueOf(userinfo.getUser().getOrgName());//仓库名称
        model.addAttribute("ckmc",ckmc);
        model.addAttribute("id",id);
        return "base/kuqu/updateKuqu";
    }
    /*跳转到库区详情页面*/
    @RequestMapping(value = "/getFindKq")
    public String getFindKq(String id, Model model) {
        System.out.println("库区id："+id);
        model.addAttribute("id",id);
        return "base/kuqu/kuqu_xiangxi";
    }

}
